import Vue from 'vue'

import VueRouter from 'vue-router'

Vue.use(VueRouter)

import Home from '../views/home/Home.vue'
import Search from '../views/search/search.vue'

const routes = [
  {
    name: 'details',
    path: '/details',
    component: () => import('../views/datails/details.vue')
  },
  {
    name: 'appointment',
    path: '/appointment',
    component: () => import('../views/appointment/appointment.vue')
  },
    {name: 'search',
    path: '/search',
    component:Search,
    component: () => import('../views/search/search.vue')
  },

  {
    name: 'home',
    path: '/',
    component: Home,
    redirect: '/carouse',
    children: [
      {
        name: 'carouse',
        path: 'carouse',
        component: () => import('../views/home/advertisement/carouse.vue')
      },

      {
        name: 'tiyan',
        path: 'tiyan',
        redirect: '/tiyan/tymoren',
        component: () => import('../views/home/tiyan/tiyan.vue'),
        children: [
          {
            name: 'tymoren',
            path: 'tymoren',
            meta: {
              index: 1
            },
            component: () => import('../views/home/tiyan/tymoren.vue')
          },
          {
            name: 'tyxiaoliang',
            path: 'tyxiaoliang',
            component: () => import('../views/home/tiyan/tyxiaoliang.vue')
          },
          {
            name: 'tyjiage',
            path: 'tyjiage',
            component: () => import('../views/home/tiyan/tyjiage.vue')
          }
        ]
      },
      {
        name: 'kouqiang',
        path: 'kouqiang',
        redirect: '/kouqiang/kqmoren',
        component: () => import('../views/home/kouqiang/kouqiang.vue'),
        children: [
          {
            name: 'kqmoren',
            path: 'kqmoren',
            meta: {
              index: 1
            },
            component: () => import('../views/home/kouqiang/kqmoren.vue')
          },
          {
            name: 'kqxiaoliang',
            path: 'kqxiaoliang',
            component: () => import('../views/home/kouqiang/kqxiaoliang.vue')
          },
          {
            name: 'kqjiage',
            path: 'kqjiage',
            component: () => import('../views/home/kouqiang/kqjiage.vue')
          }
        ]
      },
      {
        name: 'yimiao',
        path: 'yimiao',
        redirect: '/yimiao/ymmoren',
        component: () => import('../views/home/yimiao/yimiao.vue'),
        children: [
          {
            name: 'ymmoren',
            path: 'ymmoren',
            meta: {
              index: 1
            },
            component: () => import('../views/home/yimiao/ymmoren.vue')
          },
          {
            name: 'ymxiaoliang',
            path: 'ymxiaoliang',
            component: () => import('../views/home/yimiao/ymxiaoliang.vue')
          },
          {
            name: 'ymjiage',
            path: 'ymjiage',
            component: () => import('../views/home/yimiao/ymjiage.vue')
          }
        ]
      },
      {
        name: 'jiyin',
        path: 'jiyin',
        redirect: '/jiyin/jymoren',
        component: () => import('../views/home/jiyin/jiyin.vue'),
        children: [
          {
            name: 'jymoren',
            path: 'jymoren',
            meta: {
              index: 1
            },
            component: () => import('../views/home/jiyin/jymoren.vue')
          },
          {
            name: 'jyxiaoliang',
            path: 'jyxiaoliang',
            component: () => import('../views/home/jiyin/jyxiaoliang.vue')
          },
          {
            name: 'jyjiage',
            path: 'jyjiage',
            component: () => import('../views/home/jiyin/jyjiage.vue')
          }
        ]
      },
          {
            name:'Products',
            path:'Products',
            component:()=>import('../views/cart/Products')
          }

    ]

  },
  {
    name:'cart',
    path:'/cart',
    component:()=>import('../views/cart/Cart.vue')
  },
  {
    name:'scan',
    path:'/scan',
    component:()=>import('../views/cart/scan')
  }

]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
